import cv2
#import matplotlib.pyplot as plt
#import numpy as np

img=cv2.imread('cat.jpg')

#print(img)



cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

#灰度
img=cv2.imread('cat.jpg', cv2.IMREAD_GRAYSCALE)
cv2.imshow('image', img)

cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.imwrite('mycat.png',img)


#截取部分图像数据
img=cv2.imread('cat.jpg')
print(img.shape)
cat=img[0:50,0:200]

cv2.imshow('image', cat)
cv2.waitKey(0)
cv2.destroyAllWindows()

